-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CB-5511 fix: pagination #2906
CB-5511 fix: pagination #2906
Conversation
@@ -240,6 +242,7 @@ export class UsersResource extends CachedMapResource<string, AdminUser, UserReso | |||
} | |||
|
|||
const usersList: AdminUser[] = []; | |||
const pages: Parameters<typeof this.offsetPagination.setPage>[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets create a separate type for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure that we need it, because we don't and can't use it anywhere to declare exact implementation, instead we have several places when we need to "delay" setPage
call (we want to call it synchronously in same action with data mutation and after data mutation)
Probably we can want in future ability to delay setPage call via API but not with this array of arguments + for each + call
from: true, | ||
to: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why true?
may be observable
also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, seems strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's shorthand for from: observable
// if (pageKey) { | ||
// metadata.offsetPage = observable({ | ||
// ...metadata.offsetPage, | ||
// pages: expandOffsetPageRange(metadata.offsetPage?.pages || [], pageKey.options, false), | ||
// }); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about this logic? should it be deleted at all or handled in a different way according to new api?
now I can see that pages wont be marked as loaded. is it correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will delete it, pages have different logic
@@ -114,39 +114,48 @@ export function limitOffsetPages(pages: IResourceOffsetPage[], limit: number): I | |||
return result; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really hard to read what is going on here. please at least TODO to make it more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, removed (it's not in use anymore)
setPageEnd(key: ResourceAlias<TKey, Readonly<ICachedResourceOffsetPageOptions>>, hasNextPage: boolean): void { | ||
const count = key.options.offset + key.options.limit; | ||
setPage(key: ResourceAlias<TKey, Readonly<ICachedResourceOffsetPageOptions>>, items: any[], hasNextPage: boolean) { | ||
items = [...items]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, fixed
from: true, | ||
to: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, seems strange
from: true, | ||
to: true, | ||
items: observable.shallow, | ||
outdated: observable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
observable.ref maybe? as its a boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no difference for primitives actually observable
and observable.ref
will have same effect (and true)
No description provided.